import requests

from basic.base_requests import MerchantRequests


class URL:
    MERCHANT_PRODUCT_LIST = "/api/admin/merchant/product/list"
    MERCHANT_PRODUCT_INFO = "/api/admin/merchant/product/info"
    MERCHANT_PRODUCT_QUICK_STOCK_ADD = "/api/admin/merchant/product/quick/stock/add"
class MerchantProduct(MerchantRequests):
    def merchant_product_list(self):
        """
        商品查询列表
        """

        params = {
            'page': '1',
            'limit': '20',
            'cateId': '',
            'keywords': '',
            'type': '1',
            'categoryId': '3',
            'temp': '1756180130',
        }

        response = self.get(self.merchant_product_list.__name__,url=URL.MERCHANT_PRODUCT_LIST,params=params,)
        return response

    def merchant_product_info(self):
        """
        商品编辑
        """

        params = {
            'temp': '1756180192',
        }

        response = self.get(self.merchant_product_info.__name__,url=URL.MERCHANT_PRODUCT_INFO,
            params=params,
        )
        return response


    def merchant_product_quick_stock_add(self):
        """
        商品库存新增
        """

        json_data = {
            'attrValueList': [
                {
                    'id': 17146,
                    'stock': 2,
                },
            ],
            'id': 3173,
        }

        response = self.post(self.merchant_product_quick_stock_add.__name__,
            url=URL.MERCHANT_PRODUCT_QUICK_STOCK_ADD,
            json=json_data,
        )
        return response


if __name__ == '__main__':
    merchant_product = MerchantProduct()
    # merchant_product.merchant_product_list()
    # merchant_product.merchant_product_info()
    merchant_product.merchant_product_quick_stock_add()
